﻿@section HtmlHead{
    <link href="@Url.Content("/areas/mvccmsoptin/content/demo_page.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("/areas/mvccmsoptin/content/demo_table.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("/areas/mvccmsoptin/content/demo_table_jui.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("/areas/mvccmsoptin/content/start/jquery-ui-1.8.11.custom.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("/RazorThemes/" + Model._Portal.SkinName + "/css/optin.css")" rel="stylesheet" type="text/css" />
}

<div class="contentpage-outerdiv">
    <h2>Manage Opt-In Subscribers</h2>
    <div id="container">    
        <div class="breadcrumb">
                <span><a href="/optin-manager">Main Menu</a></span><span>» </span><span>Subscribers</span>
        </div>
        <table cellspacing="0" cellpadding="5" border="0">
        <tr>
            <td colspan="2" class="toolbar">
                [ <a href="/optin-manager/addsubscriber">Add</a> ]&nbsp;[ <a href="/optin-manager/importfromsite">Import From Site</a> ]
                &nbsp;[ <a href="/optin-manager/importfromcommaseperated">Import From Comma Seperated List</a> ]
            </td>
        </tr>
        </table>
        <div class="MvcCmsDataGrid">        
            <table cellpadding="0" cellspacing="0" border="0" class="display" id="subscribers">
	            <thead>
		            <tr>
			            <th>Name</th>
			            <th>Email</th>
			            <th>DoNotContact</th>
			            <th>Format</th>
                        <th>Edit</th>
			            <th>Delete</th>                        
		            </tr>
	            </thead>
	            <tbody></tbody>
            </table>
        </div>
    </div>
</div> 
<select class="optinSearchListParams" id="SearchColumns">
    <option value="All">All</option>
    <option value="Name">Name</option>
    <option value="Email">Email</option>
    <option value="DoNotContact">Do Not Contact</option>
    <option value="Format">Format</option>
</select>
@section ScriptContent{
<script src="@Url.Content("/areas/mvccmsoptin/scripts/jquery.dataTables.min.js")" type="text/javascript"></script>
<script src="@Url.Content("/areas/mvccmsoptin/scripts/dataTableExt.oApi.fnSetFilteringPressEnter.js")" type="text/javascript"></script>
<script type="text/javascript" charset="utf-8">
    $(document).ready(function () {
        $('#subscribers').dataTable({
            "bProcessing": true,
            "bServerSide": true,
            "iDisplayLength": 10,
            "bLengthChange": true,
            "aaSorting": [[0, 'asc'], [2, 'desc']],
            "aLengthMenu": [10, 20, 40],
            "aoColumns": [
                { "sName": "Name", "sWidth": "45%" },
                { "sName": "Email" },
                { "sName": "DoNotContact" },
                { "sName": "Format" },
                { "sName": "Edit", "bSearchable": false, "bSortable": false, "sClass": "edit-column" },
                { "sName": "Delete", "bSearchable": false, "bSortable": false, "sClass": "edit-column" }                
            ],
            "bJQueryUI": true,
            "sPaginationType": "full_numbers",
            "sAjaxSource": "/optinajax/listsubscribers",
            "fnInitComplete": function () {
                var searchFilter = $("#SearchColumns");
                $("#subscribers_filter").append(searchFilter);
            },
            "fnServerData": function (sSource, aoData, fnCallback) {
                aoData.push({ name: "sSingleSearchField", value: $("#SearchColumns").val() });
                $.ajax({
                    "dataType": 'json',
                    "type": "POST",
                    "url": sSource,
                    "data": aoData,
                    "success": fnCallback
                })
            }
        }).fnSetFilteringPressEnter();
    });
    function Delete(emailAddress, subscriberId) {
        var doit = confirm("are you sure you want to delete subscriber " + emailAddress + "?");
        if (doit) {
            window.location.href = "/optin-manager/subscribers/" + subscriberId;
        }
    }
</script>
}


